var reviveCount = 5;
var mapIds = [221030910];
var 准备地图 = 221030900;

function init() {}

function setup(c, a) {
    em.setProperty("leader", "true");
    em.setProperty("state", "1");
    var c = em.newInstance("Boss_地球防御本部_卡雄_普通");
    for (var b = 0; b < mapIds.length; b++) {
        var e = c.setInstanceMap(mapIds[b]);
        e.resetFully();
        e.killAllMonsters(false)
    }
    var d = em.getMonster(8880200);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(280, 248));
    var d = em.getMonster(8880202);
    e.spawnMonsterOnGroundBelow(d, new java.awt.Point(580, 248));
    c.startEventTimer(15 * 60 * 1000);
    return c
}

function onPlayerRegistered(b, a) {
    var c = b.getMapInstance(0);
    a.changeMap(c, c.getPortal(0))
}

function onPlayerRevived(b, a) {
    if (a.getReviveCount() > 0) {
        var c = a.getMap();
        a.eventRevive();
        a.changeMap(c, c.getPortal(0));
        return true
    }
    var c = b.getMapFactoryMap(mapIds[1]);
    a.changeMap(c, c.getPortal(0));
    return true
}

function onTimeOut(a) {
    a.disposeIfPlayerBelow(100, 准备地图);
    em.setProperty("state", "0");
    em.setProperty("leader", "true")
}

function onMapChanged(c, b, a) {
    if (mapIds.indexOf(a) < 0) {
        c.unregisterPlayer(b);
        if (c.disposeIfPlayerBelow(0, 0)) {
            em.setProperty("state", "0");
            em.setProperty("leader", "true")
        }
    }
}

function onPlayerDisconnected(b, a) {
    return 0
}

function onMonsterKilled(a, b) {
    if (b == 8880200) {
        player.getAPI().updateAchievement(692, 0, 1, 10);
        player.getAPI().updateAchievement(693, 0, 1, 100);
        player.getAPI().updateAchievement(694, 0, 1, 1000);
        player.getAPI().updateAchievement(695, 0, 1, 1000);
        player.getMap().killAllMonsters(true);
        a.startEventTimer(5 * 60 * 1000)
    }
    return 1
}

function playerExit(b, a) {
    b.unregisterPlayer(a);
    if (b.disposeIfPlayerBelow(0, 0)) {
        em.setProperty("state", "0");
        em.setProperty("leader", "true")
    }
}

function end(a) {
    if (a.disposeIfPlayerBelow(100, mapIds[1])) {
        em.setProperty("state", "0");
        em.setProperty("leader", "true")
    }
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}

function onItemPickedUp(b, a, c) {};